package com.cmstop.bzgd.ui.adapter.holder;

import android.content.Context;
import android.content.Intent;
import android.view.View;

import com.cmstop.bzgd.R;
import com.cmstop.bzgd.base.BaseActivity;
import com.cmstop.bzgd.beans.NewSpecialAreaBean;

import com.cmstop.bzgd.ui.activities.CommonCultureActivity;
import com.cmstop.bzgd.ui.utils.GlideUtil;
import com.ruihang.generalibrary.ui.widget.CustomEXImageView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class NewSpecialAreaHolder extends BaseAbsHolder<NewSpecialAreaBean>   {

    public boolean isMute = true;

    @BindView(R.id.secretary_img)
    protected CustomEXImageView secretaryImg;
    @BindView(R.id.county_magistrate_img)
    protected CustomEXImageView countyMagistrateImg;

    private NewSpecialAreaBean areaBean;

    public NewSpecialAreaHolder(Context context, View itemView ) {
        super(context, itemView);

    }

    public boolean isMute() {
        return isMute;
    }

    public void setMute(boolean mute) {
        isMute = mute;
    }

    @Override
    protected void initInject() {
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(NewSpecialAreaBean a) {
        areaBean = a;
        GlideUtil.getGlideWithSmall169DefCenterCrop(context, areaBean.getSecretaryImg()).into(secretaryImg);
        GlideUtil.getGlideWithSmall169DefCenterCrop(context, areaBean.getCountyMagistrateImg()).into( countyMagistrateImg);
    }


    @OnClick({R.id.secretary_layout, R.id.county_magistrate_layout })
    public void itemClick(View view) {
        Intent intent = new Intent(context, CommonCultureActivity.class);
        if(view.getId() == R.id.secretary_layout) {
            intent.putExtra(BaseActivity.EX_URL, areaBean.getSecretaryUrl());
            intent.putExtra(BaseActivity.EX_TITLE, "书记专栏");
        }else if(view.getId() == R.id.county_magistrate_layout){
            intent.putExtra(BaseActivity.EX_URL, areaBean.getCountyMagistrateUrl());
            intent.putExtra(BaseActivity.EX_TITLE, areaBean.getCountyMagistrateName());
        }
        context.startActivity(intent);

    }

}
